export default {

  methods: {

    clearTableSelection(table) {
      const _table = this.$refs[table]
      _table.clearSelection()
    },

    //  验证表格
    validateForm(formName='formData') {
      return new Promise((resolve, reject) => {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            console.log('submit ---!!!');
            resolve('valid')
          } else {
            console.log('error submit!!!')
            reject('validateFail')
          }
        })
      })
    },

    //  重置表格
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },

    //  清空表单验证
    clearValidate(formName='formData') {
      this.$nextTick(()=> {
        this.$refs[formName].clearValidate()
      })
    }


  }
}
